<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
	<head>
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="format-detection" content="telephone=no" />
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<link href="css/bksystem.css" rel="stylesheet" type="text/css" />
		<link href="font/iconfont.css" rel="stylesheet" type="text/css" />
		<link href="css/module.css" rel="stylesheet" type="text/css" />
		<link href="css/pages.css" rel="stylesheet" type="text/css" />
		<title>积分详情</title>
		<script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>
		<script src="js/jquery.cookie.js" type="text/javascript"></script>
		<script src="js/jquery.nicescroll.js" type="text/javascript"></script>
		<script src="js/HUpages.js" type="text/javascript"></script>
	</head>
	<style>
		body {
			font-family: Arial, sans-serif;
			background-color: #F5F5F5;
			margin: 0;
			padding: 20px;
		}

		h1 {
			font-weight: bold;
			color: #333;
			margin-bottom: 30px;
		}

		form {
			margin-bottom: 20px;
		}

		label {
			display: inline-block;
			width: 120px;
			text-align: right;
			margin-right: 10px;
			font-weight: bold;
		}
		input[type="text"],
		select {
			padding: 5px;
			border: 1px solid #999;
			border-radius: 3px;
		}

		input[type="submit"],
		input[type="button"] {
			padding: 8px 16px;
			font-weight: bold;
			background-color: #007bff;
			color: #FFF;
			border: none;
			border-radius: 3px;
			cursor: pointer;
		}

		table {
			width: 100%;
			border-collapse: collapse;
		}

		th, td {
			padding: 8px;
			border-bottom: 1px solid #DDD;
			text-align: center;
		}

		th {
			background-color: #f2f2f2;
			font-weight: bold;
		}

		tr:nth-child(even) {
			background-color: #f9f9f9;
		}

		.error-message {
			color: red;
			font-weight: bold;
			margin-top: 10px;
		}
	</style>
	<body id="pagestyle" class="padding15">
		<div class="Bombbox-info Tab-Module">
			<ul class="tab_memu box">
				<li class="boxbox-flex2">
					<a href="javascript:void(0)" class="memu_title btn btn-border clickBombbox selected" data-id="0">积分详情</a>
				</li>
				<li class="boxbox-flex2">
					<a href="javascript:void(0)" class="memu_title btn btn-border clickBombbox" data-id="1">积分兑换</a>
				</li>
				<li class="boxbox-flex2">
					<a href="javascript:void(0)" class="memu_title btn btn-border clickBombbox" data-id="2">联系方式设置</a>
				</li>
			</ul>
			<div class="tab-box tabcontent">
				<div class="tab-conent prompt_style active">
					<ul class="clearfix add_style">
	<body>
	<h1>积分信息</h1>

	<label for="name">姓名：</label>
	<input type="text" name="name" id="name">
	<input type="submit" value="搜索" onclick="likeAdmin()">

	<form action="" method="post">
		<table>
			<thead>
			<tr>
				<th>用户姓名</th>
				<th>用户积分</th>
				<th>用户等级</th>
				<th>积分品级</th>
			</tr>
			</thead>
			<tbody>
			</tbody>
		</table>
		<script>
			$.ajax({
				"url": "PointsServlet",
				"type": "post",
				"dataType": "json",
				"success": function(data) {
					var tbodyStr = "";
					$(data).each(function(index, item) {
						tbodyStr += '  <tr>' +
								'        <td>'+ item.userName + '</td>'+
								'        <td>'+ item.points+ '</td>'+
								'        <td>'+ item.lv+ '</td>';
						if (item.integraLevel === 1) {
							tbodyStr += '<td style="color: #adb8c0">白银</td>';
						} else if (item.integraLevel === 2) {
							tbodyStr += '<td style="color: orange">黄金</td>';
						}else if (item.integraLevel===3){
							tbodyStr += '<td style="color: #707070">骨灰</td>';
						}
						tbodyStr +=
								'        <td><a onclick="del(\'' + item.id + '\')" style="text-decoration: underline; color: red;">删除</a></td>' +' ' +
								'      </tr>';
					});
					$("tbody").html(tbodyStr);
				}
			});
			function likeAdmin() {
				var name = $("#name").val();$.ajax({
					"url": "PointsServlet",
					"type": "post",
					"dataType": "json",
					"success": function(data) {
						var tbodyStr = "";
						$(data).each(function(index, item) {
							tbodyStr += '  <tr>' +
									'        <td>'+ item.userName + '</td>'+
									'        <td>'+ item.points+ '</td>'+
									'        <td>'+ item.lv+ '</td>';
							if (item.integraLevel === 1) {
								tbodyStr += '<td style="color: #adb8c0">白银</td>';
							} else if (item.integraLevel === 2) {
								tbodyStr += '<td style="color: orange">黄金</td>';
							}else if (item.integraLevel===3){
								tbodyStr += '<td style="color: #707070">骨灰</td>';
							}
							tbodyStr +=
									'        <td><a onclick="del(\'' + item.id + '\')" style="text-decoration: underline; color: red;">删除</a></td>' +' ' +
									'      </tr>';
						});
						$("tbody").html(tbodyStr);
					}
				});
			}
			function del(idStr) {
				var result = confirm("确认删除这位用户?");
				if (result) {
					$.ajax({
						url: "AdminDelServlet",
						type: "post",
						data: "id=" + idStr,
						success: function (temp) {
							if (parseInt(temp) > 0) {
								alert("删除成功");
								location.reload();
							} else {
								alert("删除失败!");
							}
						}
					})
				}
			}
		</script>
	</form>
	</body>
					</ul>
					<div class="buttonstyle">
						<a href="javascript:" title="保存添加" class="btn padding10 bg-deep-blue">保存添加</a>
						
					</div>
					
				</div>
				<div class="tab-conent prompt_style " onclick="Card()">
					<h1>积分兑换</h1>
					<table>
						<thead>
						<tr>
							<th>优惠劵</th>
							<th>积分价值</th>
							<th>礼卡兑换日期</th>
							<th>礼卡截至日期</th>
						</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<script>
						function Card(){
							$.ajax({
								"url": "CardListServlet",
								"type": "post",
								"dataType": "json",
								"success": function(data) {
									var tbodyStr = "";
									$(data).each(function(index, item) {
										tbodyStr += '  <tr>' +
												'        <td>'+ item.cardName + '</td>'+
												'        <td>'+ item.value+ '</td>'+
												'        <td>'+ item.dateReceived+ '</td>'+
												'        <td>'+ item.dateUsed+ '</td>';
									});
									$("tbody").html(tbodyStr);
								}
							});
						}
					</script>
				</div>
				<div class="tab-conent prompt_style ">

				</div>
			</div>
		</div>
	</body>

</html>
<script>
	//内页框架
	$(function() {
		$("#pagestyle").Hupage({
			pagecontent:'.Bombbox-info',//自定义属性
			tabcontent:'.tabcontent',
			tabmemu:'.tab_memu',
			scrollbar: function(e) {
				e.niceScroll({
					cursorcolor: "#dddddd",
					cursoropacitymax: 1,
					touchbehavior: false,
					cursorwidth: "3px",
					cursorborder: "0",
					cursorborderradius: "3px",
				});
			},
			expand: function(thisBox, settings) {
				 $(settings.pagecontent).css({height:$(window).height()-30});
				settings.scrollbar($(settings.tabcontent).css({height:$(window).height()-$(settings.tabmemu).outerHeight()-30}));
			}
		})
	})
</script>